angular
      .module('app',['ngRoute'])
      .config(function($routeProvider){
            $routeProvider
                  .when('/a',{
                        templateUrl:'views/a.html',
                        controller:'c1'
                  })
                  .when('/b',{
                        templateUrl:'views/b.html',
                        controller:'c2'
                  })
                  .when('/users',{
                        templateUrl:'views/user-manager.html',
                        controller:'userData'
                  })
                  .otherwise({
                        templateUrl:'views/default.html',
                        controller:'default'
                  })
      })
      .controller('c1',function($scope,$http){
            $http({method:'GET',url:'data/contDefault.json'})
                  .success(function(data,status){
                        console.log(status);
                        $scope.headerText = data.headerText;
                        $scope.mainContent = data.main;
                  })
                  .error(function(data,status){
                        console.log(status);
                  })

      })
      .controller('c2',function($scope,$http){
            $http({method:'GET',url:'data/prost.json'})
                  .success(function(data,status){
                        console.log(status);
                        $scope.hi = data.hi;
                  })
      })
      .controller('userData',function($scope){
            $scope.Users = getItem("All_Users_List");

      })
      .controller('default',function($scope){
            $scope.default = "default header";
            $scope.defaultCont = "default content";
      });



var getItem = function(stro){
      var lc = localStorage.getItem(stro);
      var arr = lc.split("},");
      for(var i = 0;i<arr.length;i++){
            arr[i]+="}";
      }
      arr[arr.length-1] = arr[arr.length-1].substring(0, arr[arr.length-1].length - 1);
      for(var i = 0;i<arr.length;i++){
            arr[i] = JSON.parse(arr[i]);
      }
      return arr;
};